package com.wondream.myframework.app.common.config.datasource;

/**
 * @author wondream
 * @version 1.0
 * @create 2022/11/10 11:54 PM
 */
public class DynamicDataSourceHolder {
    private static final String master = "masterDataSource";

    private static final String slave = "slaveDataSource";

    private static final ThreadLocal<String> holder = new ThreadLocal<>();

    public static void markMaster() {
        holder.set(master);
    }

    public static void markSlave() {
        holder.set(slave);
    }

    public static String getCurrent() {
        return holder.get();
    }
}

